package org.smart4j.framework.helper;

import org.smart4j.framework.ConfigConstant;
import org.smart4j.framework.utils.PropertiesUtil;

import java.util.Properties;

/**
 * @author chen
 * @version V1.0
 * @date 2017/9/27
 */
public class ConfigHelper {
    private static final Properties PROPERTIES = PropertiesUtil.loadProperties(ConfigConstant.CONFIG_FILE);

    /**
     * 获取jdbcDriver
     * @return
     */
    public static String getJdbcDriver() {
        return PropertiesUtil.getString(PROPERTIES, ConfigConstant.JDBC_DRIVER);
    }

    /**
     * 获取jdbcUrl
     * @return
     */
    public static String getJdbcUrl() {
        return PropertiesUtil.getString(PROPERTIES, ConfigConstant.JDBC_URL);
    }

    /**
     * 获取jdbcUserName
     * @return
     */
    public static String getJdbcUserName() {
        return PropertiesUtil.getString(PROPERTIES, ConfigConstant.JDBC_USERNAME);
    }

    /**
     * 获取基础扫描包路径
     * @return
     */
    public static String getAppBasePackage() {
        return PropertiesUtil.getString(PROPERTIES, ConfigConstant.APP_BASE_PACKAGE);
    }

    /**
     * 获取jsp路径，默认为/WEB-INF/view/
     * @return
     */
    public static String getAppJspPath() {
        return PropertiesUtil.getString(PROPERTIES, ConfigConstant.APP_JSP_PATH, ConfigConstant.APP_JSP_PATH_DEFAULT);
    }

    /**
     * 获取静态资源路径，默认为/asset/
     * @return
     */
    public static String getAppAssetPath() {
        return PropertiesUtil.getString(PROPERTIES, ConfigConstant.APP_ASSET_PATH, ConfigConstant.APP_ASSET_PATH_DEFAULT);
    }

}
